<template>
  <el-table :data="tableData" stripe style="width: 100%">
    <el-table-column prop="product[0].productId" label="商品ID" width="180" />
    <el-table-column prop="product[0].productName" label="名称" width="180" />
    <el-table-column prop="count" label="数量" width="180" />
    <el-table-column prop="totalPrice" label="总价格" width="180" />
  </el-table>
</template>
<script>
import { ref } from 'vue'
import axios from 'axios'
export default {
  name: 'SaleInfo',
  setup () {
    const tableData = ref([])
    // const arr = [
    //   {
    //     id: 1,
    //     name: '拖拉机',
    //     count: 2,
    //     totalPrice: 200000
    //   },
    //   {
    //     id: 2,
    //     name: '挖掘机',
    //     count: 1,
    //     totalPrice: 100000
    //   },
    //   {
    //     id: 1,
    //     name: '锅盔',
    //     count: 30,
    //     totalPrice: 30
    //   }
    // ]
    // tableData.value = arr
    const getSaleInfo = async () => {
      const result = await axios.get('http://localhost:8080/api/order/list')
      tableData.value = result.data.data
      console.log(result.data.data)
    }
    getSaleInfo()
    return {
      tableData
    }
  }
}
</script>
